package es.capgemini.extjsplugin.ui;

import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.SWT;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class ComponentSelectionPanel extends org.eclipse.swt.widgets.Composite {
	private Group groupExtjs;
	private Group groupSpring;
	private Button chkFlows;
	private Button chkDto;
	private Button chkDao;
	private Button chkManager;
	private Button chkForm;
	private Button chkButtons;
	private Button chkListado;

	
	/**
	* Overriding checkSubclass allows this class to extend org.eclipse.swt.widgets.Composite
	*/	
	protected void checkSubclass() {
	}
	
	public ComponentSelectionPanel(org.eclipse.swt.widgets.Composite parent, int style) {
		super(parent, style);
		initGUI();
	}

	private void initGUI() {
		try {
			FormLayout thisLayout = new FormLayout();
			this.setLayout(thisLayout);
			{
				groupSpring = new Group(this, SWT.NONE);
				groupSpring.setLayout(null);
				FormData groupSpringLData = new FormData();
				groupSpringLData.left =  new FormAttachment(0, 1000, 21);
				groupSpringLData.top =  new FormAttachment(0, 1000, 147);
				groupSpringLData.width = 324;
				groupSpringLData.height = 121;
				groupSpring.setLayoutData(groupSpringLData);
				groupSpring.setText("Componentes Spring");
				{
					chkFlows = new Button(groupSpring, SWT.CHECK | SWT.LEFT);
					chkFlows.setText("Flows");
					chkFlows.setBounds(7, 29, 93, 16);
					chkFlows.setSelection(true);
				}
				{
					chkManager = new Button(groupSpring, SWT.CHECK | SWT.LEFT);
					chkManager.setText("Manager");
					chkManager.setSize(60, 30);
					chkManager.setBounds(7, 51, 60, 30);
					chkManager.setSelection(true);
				}
				{
					chkDao = new Button(groupSpring, SWT.CHECK | SWT.LEFT);
					chkDao.setText("Dao");
					chkDao.setBounds(7, 79, 60, 30);
					chkDao.setSelection(true);
				}
				{
					chkDto = new Button(groupSpring, SWT.CHECK | SWT.LEFT);
					chkDto.setText("Dto");
					chkDto.setSize(60, 30);
					chkDto.setBounds(7, 109, 60, 30);
					chkDto.setSelection(true);
				}
			}
			{
				groupExtjs = new Group(this, SWT.NONE);
				groupExtjs.setLayout(null);
				FormData groupExtjsLData = new FormData();
				groupExtjsLData.left =  new FormAttachment(0, 1000, 21);
				groupExtjsLData.top =  new FormAttachment(0, 1000, 12);
				groupExtjsLData.width = 324;
				groupExtjsLData.height = 97;
				groupExtjs.setLayoutData(groupExtjsLData);
				groupExtjs.setText("Componentes ExtJS");
				{
					chkListado = new Button(groupExtjs, SWT.CHECK | SWT.LEFT);
					chkListado.setText("Grid (Listado)");
					chkListado.setBounds(8, 25, 85, 16);
					chkListado.setSelection(true);
					chkListado.addSelectionListener(new SelectionListener() {
						
						@Override
						public void widgetSelected(SelectionEvent arg0) {
							chkButtons.setSelection(chkListado.getSelection());
							chkButtons.setEnabled(chkListado.getSelection());
							
						}
						
						@Override
						public void widgetDefaultSelected(SelectionEvent arg0) {
							
							
						}
					});
					

				}
				{
					chkButtons = new Button(groupExtjs, SWT.CHECK | SWT.LEFT);
					chkButtons.setText("Incluir botones Borrado/Edicion");
					chkButtons.setBounds(47, 47, 170, 16);
					chkButtons.setSelection(true);
				}
				{
					chkForm = new Button(groupExtjs, SWT.CHECK | SWT.LEFT);
					chkForm.setText("Formulario Alta/Edicion");
					chkForm.setBounds(8, 68, 227, 30);
					chkForm.setSelection(true);
				}
			}
			this.layout();
			pack();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public Button getChkButtons() {
		return chkButtons;
	}

	public Button getChkListado() {
		return chkListado;
	}

	public Button getChkForm() {
		return chkForm;
	}
	
	public Button getChkFlows() {
		return chkFlows;
	}
	
	public Button getChkManager() {
		return chkManager;
	}
	
	public Button getChkDao() {
		return chkDao;
	}
	
	public Button getChkDto() {
		return chkDto;
	}

	public boolean canFinish() {
		if(chkFlows.getSelection())return true;
		if(chkDto.getSelection())return true;
		if(chkDao.getSelection())return true;
		if(chkManager.getSelection())return true;
		if(chkForm.getSelection())return true;
		if(chkButtons.getSelection())return true;
		if(chkListado.getSelection())return true;
		return false;
	}

}
